<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>instanceOf</title>
</head>
<body>
    
</body>
</html>
<script>
    function myInstanceOf(left,right){
        let leftValue = left.__proto__
        let rightValue= right.prototype
        while(leftValue!==null){       //只要顺着原型链还没取到镜头就可以一直取    并在此循环内一直判断
            if(leftValue===rightValue){     //在此处判断实例的隐士原型是否等于构造函数的显示原型
                return true
            }
            // 如果不等于，继续顺着原型链取
            leftValue = leftValue.__proto__
        }
            return false

    }
    console.log(myInstanceOf('q',Number))
    console.log(myInstanceOf({},Object))
    console.log(myInstanceOf([],Array))
</script>